﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;

namespace MDK.Common.Helper
{
    public class SpeechHelper
    {
        static SpeechHelper()
        {
            Speech = new SpeechSynthesizer();
            var voice = Speech.GetInstalledVoices(CultureInfo.GetCultureInfo("zh-CN"));
            if (voice.Count >= 1)
            {
                Speech.SelectVoice(voice[0].VoiceInfo.Name);
            }
        }

        public static SpeechSynthesizer Speech { get; private set; }

        public static void Speek(string speek)
        {
            Speech.Speak(speek);
        }

        public static void SpeekAynsc(string speek)
        {
            Speech.SpeakAsync(speek);
        }
    }
}
